{
GtkWidget *A, *B, *C;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
- point_update (&mouse_state, C, 10, 10);
- point_press (&mouse_state, C, 1);
+ gtk_widget_get_allocation (A, &allocation);
+
+ point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
+ point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1, "
{
GtkWidget *A, *B, *C;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_legacy (B, str, GDK_EVENT_PROPAGATE);
add_legacy (C, str, GDK_EVENT_PROPAGATE);
- point_update (&mouse_state, C, 10, 10);
- point_press (&mouse_state, C, 1);
+ gtk_widget_get_allocation (A, &allocation);
+
+ point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
+ point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1, "
{
GtkWidget *A, *B, *C;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_legacy (B, str, GDK_EVENT_STOP);
add_legacy (C, str, GDK_EVENT_PROPAGATE);
- point_update (&mouse_state, C, 10, 10);
- point_press (&mouse_state, C, 1);
+ gtk_widget_get_allocation (A, &allocation);
+
+ point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
+ point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1, "
{
GtkWidget *A, *B, *C;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
- point_update (&mouse_state, C, 10, 10);
- point_press (&mouse_state, C, 1);
+ gtk_widget_get_allocation (A, &allocation);
+
+ point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
+ point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1, "
{
GtkWidget *A, *B, *C;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
- point_update (&mouse_state, C, 10, 10);
- point_press (&mouse_state, C, 1);
+ gtk_widget_get_allocation (A, &allocation);
+ point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
+ point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1, "
{
GtkWidget *A, *B, *C;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_CLAIMED);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
- point_update (&mouse_state, C, 10, 10);
- point_press (&mouse_state, C, 1);
+ gtk_widget_get_allocation (A, &allocation);
+ point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
+ point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1, "
GtkWidget *A, *B, *C;
GtkGesture *g;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
- point_update (&mouse_state, C, 10, 10);
- point_press (&mouse_state, C, 1);
+ gtk_widget_get_allocation (A, &allocation);
+ point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
+ point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1, "
GtkWidget *A, *B, *C;
GtkGesture *g;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
- point_update (&mouse_state, C, 10, 10);
- point_press (&mouse_state, C, 1);
+ gtk_widget_get_allocation (A, &allocation);
+ point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
+ point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1, "
GtkWidget *A, *B, *C;
GString *str;
GtkGesture *g1, *g2;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c4", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
- point_update (&mouse_state, C, 10, 10);
- point_press (&mouse_state, C, 1);
+ gtk_widget_get_allocation (A, &allocation);
+
+ gtk_widget_get_allocation (A, &allocation);
+ point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
+ point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1, "
{
GtkWidget *A, *B, *C, *D;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_gesture (B, "b2", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (A, "a2", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
- point_update (&mouse_state, C, 10, 10);
- point_press (&mouse_state, C, 1);
+ gtk_widget_get_allocation (A, &allocation);
+ point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
+ point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1, "
{
GtkWidget *A, *B, *C;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_gesture (B, "b2", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (A, "a2", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
- point_update (&mouse_state, C, 10, 10);
- point_press (&mouse_state, C, 1);
+ gtk_widget_get_allocation (A, &allocation);
+ point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
+ point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1, "
/* Update with the grab under effect */
g_string_erase (str, 0, str->len);
- point_update (&mouse_state, C, 20, 20);
+ point_update (&mouse_state, A, (allocation.width / 2) + 20,
+ (allocation.height / 2) + 20);
g_assert_cmpstr (str->str, ==,
"b1 updated, "
"c1 updated, "
{
GtkWidget *A, *B, *C;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
add_gesture (A, "a1", GTK_PHASE_CAPTURE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (B, "b1", GTK_PHASE_CAPTURE, str, GTK_EVENT_SEQUENCE_CLAIMED);
+ gtk_widget_get_allocation (A, &allocation);
+
/* First touch down */
- point_update (&touch_state[0], C, 10, 10);
- point_press (&touch_state[0], C, 1);
+ point_update (&touch_state[0], A, allocation.width / 2, allocation.height / 2);
+ point_press (&touch_state[0], A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1 (1), "
/* Second touch down */
g_string_erase (str, 0, str->len);
- point_update (&touch_state[1], C, 20, 20);
- point_press (&touch_state[1], C, 1);
+ point_update (&touch_state[1], A, (allocation.width / 2) + 20,
+ (allocation.height / 2) + 20);
+ point_press (&touch_state[1], A, 1);
g_assert_cmpstr (str->str, ==,
"a1 state denied (2), "
{
GtkWidget *A, *B, *C;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
str = g_string_new ("");
add_mt_gesture (C, "c1", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_CLAIMED);
+ gtk_widget_get_allocation (A, &allocation);
/* First touch down */
- point_update (&touch_state[0], C, 10, 10);
- point_press (&touch_state[0], C, 1);
+ point_update (&touch_state[0], A, allocation.width / 2, allocation.height / 2);
+ point_press (&touch_state[0], A, 1);
g_assert_cmpstr (str->str, ==, "");
/* Second touch down */
- point_update (&touch_state[1], C, 20, 20);
- point_press (&touch_state[1], C, 1);
+ point_update (&touch_state[1], A, (allocation.width / 2) + 20,
+ (allocation.height / 2) + 20);
+ point_press (&touch_state[1], A, 1);
g_assert_cmpstr (str->str, ==,
"c1 began, "
/* A third touch down triggering again action */
g_string_erase (str, 0, str->len);
- point_update (&touch_state[2], C, 20, 20);
- point_press (&touch_state[2], C, 1);
+ point_update (&touch_state[2], A, (allocation.width / 2) + 20,
+ (allocation.height / 2) + 20);
+ point_press (&touch_state[2], A, 1);
g_assert_cmpstr (str->str, ==,
"c1 began, "
GtkWidget *A, *B, *C;
GtkGesture *g;
GString *str;
+ GtkAllocation allocation;
A = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (A, "A");
g = add_gesture (A, "a1", GTK_PHASE_CAPTURE, str, GTK_EVENT_SEQUENCE_CLAIMED);
add_mt_gesture (C, "c1", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_CLAIMED);
+ gtk_widget_get_allocation (A, &allocation);
/* First touch down, a1 claims the sequence */
- point_update (&touch_state[0], C, 10, 10);
- point_press (&touch_state[0], C, 1);
+ point_update (&touch_state[0], A, allocation.width / 2, allocation.height / 2);
+ point_press (&touch_state[0], A, 1);
g_assert_cmpstr (str->str, ==,
"capture a1 (1), "
/* Second touch down, a1 denies and c1 takes over */
g_string_erase (str, 0, str->len);
- point_update (&touch_state[1], C, 20, 20);
- point_press (&touch_state[1], C, 1);
+ point_update (&touch_state[1], A, (allocation.width / 2) + 20,
+ (allocation.height / 2) + 20);
+ point_press (&touch_state[1], A, 1);
/* Denying sequences in touch-excess situation is a responsibility of the caller */
gtk_gesture_set_state (g, GTK_EVENT_SEQUENCE_DENIED);
/* Move first point, only c1 should update */
g_string_erase (str, 0, str->len);
- point_update (&touch_state[0], C, 30, 30);
+ point_update (&touch_state[0], A, (allocation.width / 2) + 30,
+ (allocation.height / 2) + 30);
g_assert_cmpstr (str->str, ==,
"c1 updated");
/* A third touch down triggering again action on c1 */
g_string_erase (str, 0, str->len);
- point_update (&touch_state[2], C, 20, 20);
- point_press (&touch_state[2], C, 1);
+ point_update (&touch_state[2], A, (allocation.width / 2) + 20,
+ (allocation.height / 2) + 20);
+ point_press (&touch_state[2], A, 1);
g_assert_cmpstr (str->str, ==,
"a1 state denied (3), "